home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / trips.doc < prev    next >
Text File  |  1995-03-31  |  3KB  |  64 lines

  1. (Comp.sys.handhelds) 
  2. Item: 2590 by dan at Apple.COM 
  3. Author: [Dan Allen] 
  4.   Subj: City DataBase for HP-48 (LONG: 40 KB) 
  5.   Keyw: cities,HP-48,navigation 
  6.   Date: Mon Apr 01 1991 
  7.  
  8. The following programs generate random trips between cities 
  9. in a database.  The TRIPS command continuously generates trips until the 
  10. clear key is pressed.  It in turn calls CALCTRIP to display the 
  11. latitude, longitude, and elevation (in feet) of the two cities, followed 
  12. by the great circle distance in US miles, the difference in elevation, 
  13. and a rough approximation to the heading one would go in to arrive at 
  14. the destination city. 
  15.  
  16. The database is large, containing over 1,000 cities.  They are all of 
  17. the airports in the Western states (Washington, Oregon, California, 
  18. Arizona, Nevada, and Utah), as well as a few other cities in the US, 
  19. like Chicago, New York, etc. 
  20.  
  21. All of the information came from an FAA database.  Your own cities are 
  22. easily added, or these cities deleted.  In those cities that have 
  23. multiple airports, a single airport was chosen on a semi-random basis. 
  24.  
  25. The final item displayed is an approximate time that it would take to 
  26. travel between the two cities.  I chose a speed of 40 mph which 
  27. compensates for the fact that the distance is great circle distance, and 
  28. to drive between the two cities, one must follow roads which are not 
  29. great circles.  If you wish to use this for flying applications, then 
  30. you could substitute a faster speed.  The 40mph figure does a pretty 
  31. good rough approximation of what it takes to drive at 60 mph. 
  32.  
  33. A second version of TRIPS, called SLOWTRIPS, is also included when 
  34. memory is tight.  The fast TRIPS routine puts the list of cities on the 
  35. stack and picks them off of the stack, two random cities at a time.  It 
  36. is pretty zippy.  SLOWTRIPS uses the GET function to grab a list from 
  37. the city database and it is very slow. 
  38.  
  39. This whole file is about 41 KB, so you must have installed some extra 
  40. memory to run it.  Of course 40 KB of this is the city database I have 
  41. included.  Omit those cities that are of no interest to you and you can 
  42. reduce the size of this immensely. 
  43.  
  44. Another routine called BFIND allows a binary search to take place for a 
  45. given city name, with its data returned to the stack.  Calling BFIND 
  46. twice, with the source and destination names, leaves the information on 
  47. the stack so you can then call CALCTRIP to determine the distance and 
  48. rough time, course, etc. 
  49.  
  50. The format for the cities is simple: it is a list composed of other 
  51. lists, one list per city.  The list is sorted alphabetically by city 
  52. name, so that the binary search works.  Each city has the following 
  53. information associated with it in this database: 
  54.  
  55.         City name (string) 
  56.         Latitude (real) 
  57.         Longitude (real) 
  58.         Elevation (integer) 
  59.  
  60. Enjoy! 
  61.  
  62. Dan Allen 
  63. Apple Computer 
  64.